﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace AdventureWorksLT.Helpers
{
    public  class BooleanToVisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool isVisible = (bool)value;
            return isVisible ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            System.Windows.Visibility currVisibility = (System.Windows.Visibility)value;
            return (currVisibility == System.Windows.Visibility.Visible);
        }
    }
}